<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>Database - Introduction - Fuel Documentation</title>
	<link href="../../assets/css/main.css" media="screen" rel="stylesheet" />
	<script type="text/javascript" src="../../assets/js/jquery-1.4.4.min.js"></script>
	<script type="text/javascript" src="../../assets/js/nav.js"></script>
	<script type="text/javascript" src="../../assets/js/highlight.pack.js"></script>
	<script type="text/javascript">
		$(function() {
			show_nav('classes', '../../');
		});
		hljs.tabReplace = '    ';
		hljs.initHighlightingOnLoad();
	</script>
</head>
<body>

	<header>
		<h1>Fuel Documentation</h1>
	</header>

	<div id="main-nav"></div>

	<section id="content">
		<h2>Database Introduction</h2>
		<section>
			<h2>Introduction</h2>

			<p>
				Fuel offers a driver based database abstration layer. At the time of writing supported
				drivers are MySQL, MySQLi and PDO. Aside from regular database interaction, fuel also
				comes with a DBUtil class to perform database operations such as creating databases,
				adding fields and much more.
			</p>

			<p class="note">Please note that not all features are supported by every driver.</p>
		</section>

		<section>
			<h2 id="configuration">Configuration</h2>

			<p>
				In order to begin working with databases, you must change the database settings. The
				database config file is located at <em>APPPATH/config/db.php</em>.
			</p>
			<p>
				Database configurations are formated like so:
			</p>
			<pre><code>// a MySQL driver configuration
'development' => array(
	'type'           => 'mysqli',
	'connection'     => array(
		'hostname'       => 'localhost',
		'port'           => '3306',
		'database'       => 'fuel_db',
		'username'       => 'your_username',
		'password'       => 'y0uR_p@ssW0rd',
		'persistent'     => false,
	),
	'table_prefix'   => '',
	'charset'        => 'utf8',
	'caching'        => false,
	'profiling'      => false,
),

// a PDO driver configuration
'production' => array(
	'type'           => 'pdo',
	'connection'     => array(
		'dsn'            => 'mysql:host=localhost;dbname=fuel_db',
		'username'       => 'your_username',
		'password'       => 'y0uR_p@ssW0rd',
		'persistent'     => false,
	),
	'table_prefix'   => '',
	'charset'        => 'utf8',
	'caching'        => false,
	'profiling'      => false,
),</code></pre>
			<p>
				Once you have your configuration in place, it's time to <a href="./usage.html">use it</a>.
			</p>
		</section>

	</section>

	<section id="footer">
		<p>
			<a href="http://fuelphp.com">Fuel</a> is released under the MIT license.<br />
			&copy; 2010 - 2011 Fuel Development Team
		</p>
	</section>

</body>
</html>
